<?php
namespace app\services\ai\traits\qq;

trait ComputerVisionOcr
{
    /**
     * 身份证识别
     * @param $options
     * @return mixed
     */
    public function idCardOcr($options)
    {
        return $this->request(self::POST, self::API_ID_CARD_OCR, $this->parseOptions([
            'image' => $options['image'] ?? '',
            'card_type' => $options['card_type'] ?? self::OCR_ID_CARD_TYPE_FRONT,
        ]));
    }

    /**
     * 通用扫描
     * @param $options
     * @return mixed
     */
    public function generalOcr($options)
    {
        return $this->request(self::POST, self::API_GENERAL_OCR, $this->parseOptions([
            'image' => $options['image'] ?? '',
        ]));
    }

    /**
     * 图片识别
     * @param $options
     * @return mixed
     */
    public function imageTag($options)
    {
        return $this->request(self::POST, self::API_IMAGE_TAG, $this->parseOptions([
            'image' => $options['image'] ?? '',
        ]));
    }
}